window.navbarOptions = {
	list: [
		{
			icon: 'mui-icon-home',
			label: '首页',
			click:function(mui,item){
				mui.openWindow({
				    url:'index.html',
				    id:'index.html',
				    extras:{
				        name:'mui',
				        version:'0.5.8'
				    }
				});
			}
		},
		{
			icon: 'mui-icon-phone',
			label: '电话',
			click:function(mui,item){
				mui.openWindow({
					url:'second.html',
					id:'second.html',
					extras:{
						name:'mui',
						version:'0.5.8'
					}
				});
			}
		},
		{
			icon: 'mui-icon-email',
			label: '邮件',
			click:function(mui,item){
				mui.openWindow({
					url:'three.html',
					id:'three.html',
					extras:{
						name:'mui',
						version:'0.5.8'
					}
				});
			}
		},
		{
			icon: 'mui-icon-gear',
			label: '设置',
			click:function(mui,item){
				mui.openWindow({
					url:'fourth.html',
					id:'fourth.html',
					extras:{
						name:'mui',
						version:'0.5.8'
					}
				});
			}
		}
	],
	/**
	 * target 父容器id
	 * mui
	 * active 默认第几个是活跃的
	 */
	init(target,mui,active=-1) {
		var container = document.querySelector(target)
		var div = document.createElement('div')
		div.setAttribute('class','mui-bar wmui-bar-tab')
		this.list.forEach((l,index) => {
			var a = document.createElement('a')
			var _class = `wmui-tab-item ${index === active?' wmui-active' : ''}`
			 a.setAttribute('class',_class)
			a.innerHTML = `<span class="mui-icon ${l.icon}"></span>
			<span class="wmui-tab-label">${l.label}</span>`
			a.addEventListener('tap',function(e) {
				l.click(mui,l)
				e.preventDefault()
			})
			div.appendChild(a)
		})
		container.appendChild(div)
		delete window.navbarOptions
	}
}
